[PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query]
Posted
by
doniyor
on Stack Overflow
See other posts from Stack Overflow
or by doniyor
Published on 2012-06-21T13:06:03Z
Indexed on
2012/06/21
15:16 UTC
Read the original article
Hit count: 174
sql
|playframework
i need help. i am trying to select from database thru sql statement in play framework, but it gives me error, i cannot figure out where the clue is. here is the code:
@Transactional
public static Users findByUsernameAndPassword(String username, String password){
String hash = DigestUtils.md5Hex(password);
Query q = JPA.em().createNativeQuery("select * from USERS where" + "USERNAME=? and PASSWORD=?").setParameter(1, username).setParameter(2, password);
List<Users> users = q.getResultList();
if(users.isEmpty()){
return null;
} else{
return users.get(0);
here is the eror message:
[PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query]
can someone help me please! any help i would appreciate!
thanks
© Stack Overflow or respective owner